package com.lhl.cp;

import cn.hutool.json.JSONUtil;
import com.lhl.fw.core.event.CustomSpringEvent;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.event.EventListener;

/**
 * @className: com.lhl.cp.WxCpApplication
 * @description: TODO 类描述
 * @author: king
 * @date: 2020-12-11 10:32
 **/
@Api(tags = "WxCpApplication", produces = "WxCpApplication")
@Slf4j
@SpringBootApplication
@ServletComponentScan("com.lhl.jwt.filters")
public class WxCpApplication {
    public static void main(String[] args) {
        SpringApplication.run(WxCpApplication.class,args);
    }

    @EventListener(condition = "#event.getActionType()=='msg'")
    public void optT(CustomSpringEvent<WxCpXmlMessage> event) {
        log.debug(".........................................");
        log.debug("Received spring custom event - ", JSONUtil.toJsonStr(event.getT()));
    }
}
